<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理后台 - 订单管理</title>
    <link rel="stylesheet" href="./css/houtai.css">
    <link rel="stylesheet" href="./css/houtai_order.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <!-- <script src="./assets/jquery.min.js"></script> -->
    <!-- 添加Toast提示框组件 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
</head>
<body>
    <div class="wrapper">
        <!-- 侧边栏 -->
        <aside class="sidebar">
            <div class="logo">
                <h2>超市管理系统</h2>
            </div>
            <ul class="menu">
                <li><a href="./houtai_gzt.html" class="menuItem"><i class="fas fa-tachometer-alt"></i><span>工作台</span></a></li>
                <li><a href="./houtai_user.html" class="menuItem"><i class="fas fa-users"></i><span>用户管理</span></a></li>
                <li><a href="./houtai_product.html" class="menuItem"><i class="fas fa-box"></i><span>商品管理</span></a></li>
                <li><a href="./houtai_order.html" class="menuItem active"><i class="fas fa-shopping-cart"></i><span>订单管理</span></a></li>
                <li><a href="./houtai_stock.html" class="menuItem"><i class="fas fa-warehouse"></i><span>库存管理</span></a></li>
                <li><a href="./houtai_log.html" class="menuItem"><i class="fas fa-history"></i><span>日志管理</span></a></li>
            </ul>
        </aside>

        <!-- 主体部分 -->
        <main class="main-content">
            <header class="header">
                <a id="collapse" href="javascript:void(0)">
                    <i class="fas fa-bars"></i>
                </a>
                <div class="header-title">订单管理</div>
                <div class="user-info">
                    <span id="currentUser">欢迎，管理员</span>
                    <button id="logoutBtn" class="btn-logout">退出</button>
                </div>
            </header>

            <div class="container">
                <!-- 搜索栏 -->
                <div class="search-bar">
                    <div class="search-inputs">
                        <input type="text" id="searchOrderNo" placeholder="用户名" />
                        <input type="text" id="searchUserId" placeholder="手机号" />
                        <select title="sosuolan" id="searchStatus">
                            <option value="">全部状态</option>
                            <option value="0">待付款</option>
                            <option value="1">待发货</option>
                            <option value="2">已发货</option>
                            <option value="3">已完成</option>
                            <option value="4">已取消</option>
                        </select>
                        <button id="searchBtn" class="btn-primary">搜索</button>
                        <button id="resetBtn" class="btn-secondary">重置</button>
                    </div>
                </div>

                <!-- 订单列表 -->
                <div class="table-container">
                    <table id="orderTable">
                        <thead>
                            <tr>
                                <th>订单编号</th>
                                <th>用户名</th>
                                <th>订单金额</th>
                                <th>订单状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="orderList">
                            <!-- 订单数据将在这里动态插入 -->
                        </tbody>
                    </table>
                </div>

                <!-- 分页 -->
                <div class="pagination" id="pagination">
                    <button id="prevPage" class="btn-page">上一页</button>
                    <div class="page-info">
                        <span id="pageInfo">第 1 页</span>
                        <span id="totalInfo">共 0 条</span>
                    </div>
                    <button id="nextPage" class="btn-page">下一页</button>
                </div>
            </div>

            <!-- 订单详情弹窗 -->
            <div id="orderDetailModal" class="modal">
                <div class="modal-content">
                    <div class="modal-header">
                        <h3 id="modalTitle">订单详情</h3>
                        <span class="close">&times;</span>
                    </div>
                    <div class="modal-body">
                        <div class="order-info">
                            <div class="info-group">
                                <label>订单编号:</label>
                                <span id="detailOrderNo"></span>
                            </div>
                            <div class="info-group">
                                <label>用户名:</label>
                                <span id="detailUserId"></span>
                            </div>
                            <div class="info-group">
                                <label>订单金额:</label>
                                <span id="detailAmount"></span>
                            </div>
                            <div class="info-group">
                                <label>订单状态:</label>
                                <span id="detailStatus"></span>
                            </div>
                            <div class="info-group">
                                <label>创建时间:</label>
                                <span id="detailCreateTime"></span>
                            </div>
                        </div>
                        <div class="order-items">
                            <h4>订单商品</h4>
                            <table id="orderItemsTable">
                                <thead>
                                    <tr>
                                        <th>商品名称</th>
                                        <th>数量</th>
                                        <th>单价</th>
                                        <th>小计</th>
                                    </tr>
                                </thead>
                                <tbody id="orderItemsList">
                                    <!-- 订单商品列表将在这里动态插入 -->
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="status-actions">
                            <!-- 状态操作按钮将在这里动态插入 -->
                        </div>
                        <button id="closeDetail" class="btn-secondary">关闭</button>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script src="./js/houtai.js"></script>
    <script src="./js/houtai_order.js"></script>
</body>
</html>
